//获取品牌列表需要携带参数类型
export interface trademarkListData{
    page:number,
    limit:number
}

//公共返回数据类型
interface responseData{
    code:number,
    message:string,
    ok:Boolean
}

//获取基本品牌列表数据返回数据类型
export interface responseTrademarkListData extends responseData{
    data:{
        records:Object[],
        total:number,
        size:number,
        current:number,
        orders:[] | any,
        optimizeCountSql:Boolean,
        hitCount:Boolean,
        countId:any,
        maxLimit:any,
        searchCount:Boolean,
        pages:number
    }
}

//新增品牌或者更新品牌需要携带参数类型
export interface saveTrademarkData{
    createTime:string | any,
    id:number | any,
    logoUrl:string,
    tmName:string,
    updateTime:string | any
}
//新增品牌或者更新返回数据类型
export interface responseSaveTrademarkData extends responseData{
    data:null
}

//删除品牌返回数据类型
export interface responseDeleteTrademarkData extends responseData{
    data:string
}

/**
 * 商品属性部分接口类型约束
*/
interface CategoryObj{
    id:number | string,
    name:string,
    category1Id?:number,
    category2Id?:number
}
//一级、二级、三级分类返回数据类型
export interface responseProductCategoryData extends responseData {
    data:CategoryObj[]
}

interface attrValueListObj {
    id:number | any,
    valueName:string,
    attrId:number | any
}
export interface productAttrObj {
    id:number | any,
    attrName:string,
    categoryId:number,
    categoryLevel:number,
    attrValueList:attrValueListObj[]
}
//当前分类下已有的属性返回接口类型
export interface responseProductAttrValue extends responseData {
    data:productAttrObj[]
}

/**
 * SPU管理类型约束
*/
//服务器全部接口返回的数据类型
export interface ResponseData {
    code:number,
    message:string,
    ok:boolean
}
//SPU数据的ts类型
export interface spuData {
    id?:number,
    spuName:string,
    description:string,
    category3Id:string|number,
    tmId:number,
    spuSaleAttrList:null,
    spuImageList:null,
}
//数组：元素都是已有spu数据类型
export type Records = spuData[];
//定义获取已有的spu接口返回的数据ts类型
export interface HasSpuResponseData extends ResponseData{
    data:{
        records:Records,
        total:number,
        size:number,
        current:number,
        searchCount:boolean,
        pages:number
    }
}

//品牌数据的ts类型
 export interface Trademark{
    id:number,
    tmName:string,
    logoUrl:string
}
//品牌数据类型
export interface AlltradeMark extends ResponseData{
    data:Trademark[]
}

//获取商品spu图片的ts类型
export interface spuImg{
    id?:number,
    createTime?:string,
    updateTime?:string,
    spuId?:number,
    imgName?:string,
    imgUrl?:string,
}
export interface SpuHasImg extends ResponseData {
    data:spuImg[]
}

//已有的销售属性值对象的ts类型
export interface saleAttrValue {
    id?:number,
    createTime?:null,
    updateTime?:null,
    spuId?:number,
    baseSaleAttrId:number,
    saleAttrValueName:string,
    saleAttrName?:string,
    isChecked?:null
}
//存储已有的销售属性值数组类型
export type spuSaleAttrValueList = saleAttrValue[];
//销售属性对象的ts类型
export interface saleAttr {
    id?:number,
    createTime?:null,
    updateTime?:null,
    spuId?:number,
    baseSaleAttrId:number,
    saleAttrName:string,
    spuSaleAttrValueList:spuSaleAttrValueList
}
//SPU已有的销售属性接口返回的ts类型
export interface SaleAttrResponseData extends ResponseData {
    data:saleAttr[]
}

//已有的全部spu的返回数据ts类型
export interface HasSaleAttr{
    id:number,
    name:string
}
export interface hasSaleAttrResponseData extends ResponseData{
    data: HasSaleAttr[]
}

//添加或修改一个spu的请求参数类型
export interface spuDataParams{
    id?:number,
    spuName:string,
    tmId:number,
    description:string,
    category3Id:number,
    spuImageList:spuImg[] | null,  //商品图片数据
    spuSaleAttrList:saleAttr[] | null
}

//添加一个新的sku请求参数类型
export interface skuParams{
    category3Id:string|number,
    spuId:string|number,
    tmId:string|number,
    skuName:string,
    price:string|number,
    weight:string|number,
    skuDesc:string,
    skuAttrValueList:[{attrId:number,valueId:number}],
    skuSaleAttrValueList:[{saleAttrId:number,saleAttrValueId:number}],
    skuDefaultImg:string
}

//获取sku数据接口的ts类型
export interface skuInfoData extends ResponseData{
    data:skuParams[]
}